package com.ruoyi.datam.service.impl;

import com.ruoyi.common.core.domain.base.datam.VersionUpgrade;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.datam.mapper.VersionUpgradeMapper;
import com.ruoyi.datam.service.IVersionUpgradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * App版本号Service业务层处理
 *
 * @author hwd
 * @date 2023-05-18
 */
@Service
public class VersionUpgradeServiceImpl implements IVersionUpgradeService
{
    @Autowired
    private VersionUpgradeMapper versionUpgradeMapper;

    /**
     * 查询App版本号
     *
     * @param id App版本号主键
     * @return App版本号
     */
    @Override
    public VersionUpgrade selectVersionUpgradeById(Long id)
    {
        return versionUpgradeMapper.selectVersionUpgradeById(id);
    }

    /**
     * 查询App版本号列表
     *
     * @param versionUpgrade App版本号
     * @return App版本号
     */
    @Override
    public List<VersionUpgrade> selectVersionUpgradeList(VersionUpgrade versionUpgrade)
    {
        return versionUpgradeMapper.selectVersionUpgradeList(versionUpgrade);
    }

    /**
     * 新增App版本号
     *
     * @param versionUpgrade App版本号
     * @return 结果
     */
    @Override
    public int insertVersionUpgrade(VersionUpgrade versionUpgrade)
    {
        versionUpgrade.setCreateTime(DateUtils.getNowDate());
        return versionUpgradeMapper.insertVersionUpgrade(versionUpgrade);
    }

    /**
     * 修改App版本号
     *
     * @param versionUpgrade App版本号
     * @return 结果
     */
    @Override
    public int updateVersionUpgrade(VersionUpgrade versionUpgrade)
    {
        versionUpgrade.setUpdateTime(DateUtils.getNowDate());
        return versionUpgradeMapper.updateVersionUpgrade(versionUpgrade);
    }

    /**
     * 批量删除App版本号
     *
     * @param ids 需要删除的App版本号主键
     * @return 结果
     */
    @Override
    public int deleteVersionUpgradeByIds(Long[] ids)
    {
        return versionUpgradeMapper.deleteVersionUpgradeByIds(ids);
    }

    /**
     * 删除App版本号信息
     *
     * @param id App版本号主键
     * @return 结果
     */
    @Override
    public int deleteVersionUpgradeById(Long id)
    {
        return versionUpgradeMapper.deleteVersionUpgradeById(id);
    }

    @Override
    public VersionUpgrade selectVersionUpgradeNewestApp() {
        return versionUpgradeMapper.selectVersionUpgradeNewestApp();
    }
}
